<script setup>
const props = defineProps({
  icon: {
    type: String,
    default: '🔍'
  },
  title: {
    type: String,
    default: '没有找到相关内容'
  },
  description: {
    type: String,
    default: ''
  },
  showButton: {
    type: Boolean,
    default: false
  },
  buttonText: {
    type: String,
    default: '返回首页'
  }
})

const emit = defineEmits(['button-click'])

function handleButtonClick() {
  emit('button-click')
}
</script>

<template>
  <div class="empty-state">
    <div class="empty-content">
      <div class="empty-icon">{{ icon }}</div>
      <p class="empty-text">{{ title }}</p>
      <p v-if="description" class="empty-description">{{ description }}</p>
      <button v-if="showButton" class="empty-btn" @click="handleButtonClick">{{ buttonText }}</button>
    </div>
  </div>
</template>

<style scoped>
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-content {
  max-width: 400px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.8;
}

.empty-text {
  font-size: 18px;
  font-weight: 500;
  color: #333;
  margin-bottom: 8px;
}

.empty-description {
  font-size: 14px;
  color: #666;
  margin-bottom: 24px;
}

.empty-btn {
  padding: 10px 20px;
  background: #1890ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s;
}

.empty-btn:hover {
  background: #40a9ff;
}

@media (max-width: 768px) {
  .empty-state {
    padding: 40px 16px;
  }
  
  .empty-icon {
    font-size: 40px;
  }
  
  .empty-text {
    font-size: 16px;
  }
}
</style>